<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta name="format-detection" content="telephone=no,address=no,email=no" />
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width,initial-scale=1, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui,viewport-fit=cover"
    />
    <title>之了课堂</title>
    <meta name="keywords" content="之了课堂" />
    <meta
      name="description"
      content="之了课堂，是成都环宇知了科技有限公司开发的在线学习平台。之了课堂专注于会计培训，是一个综合型、创新型会计类在线教育平台及学习方案提供者，开设各类财会考试培训和实操指导，为会计人提供有效的学习方案"
    />

    <link rel="stylesheet" href="//image.zlketang.com/public/news/js/vant.css" />

    <style>
      * {
        box-sizing: border-box;
      }

      html,
      body {
        height: 100%;
        width: 100%;
      }

      body {
        margin: 0;
        font-size: 0.16rem;
        line-height: 1;
        background-image: linear-gradient(90deg, #ffd3ab 0%, #ffc9a3 100%, #ffc9a3 100%);
      }

      button {
        padding: 0;
        border: none;
      }

      .mb12 {
        margin-bottom: 0.12rem;
      }

      .mb16 {
        margin-bottom: 0.16rem;
      }

      .mb24 {
        margin-bottom: 0.24rem;
      }

      .por {
        position: relative;
      }

      .poa {
        position: absolute;
      }

      .bgc-f {
        background-color: #fff;
      }

      .bgc-f5 {
        background-color: #f5f5f5;
      }

      .svg-icon {
        width: 1em;
        height: 1em;
        fill: currentColor;
        overflow: hidden;
      }

      .page-main {
        overflow: auto;
        height: calc(100% - 0.78rem);
        width: 100%;
      }

      .page-footer {
        display: flex;
        width: 100%;
        height: 0.78rem;
      }

      .footer-btn {
        margin: auto;
        width: 3.43rem;
        height: 0.44rem;
        background-image: linear-gradient(180deg, #fe8155 0%, #ff261f 100%);
        box-shadow: 0rem 0.02rem 0.04rem 0rem rgba(0, 0, 0, 0.1),
          inset 0rem 0.01rem 0.03rem 0rem rgba(255, 255, 255, 0.2);
        border-radius: 0.1rem;
        font-size: 0.16rem;
        color: #ffffff;
      }

      .mask {
        overflow: auto;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 99;
        background-color: #00000077;
      }

      .drawer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 2.52rem;
        border-radius: 0.16rem 0.16rem 0 0;
        padding: 0.16rem;
        background-color: #ffffff;
      }

      .drawer-close-btn {
        position: absolute;
        right: 0.12rem;
        top: 0.14rem;
        width: 0.2rem;
        height: 0.2rem;
        font-size: 0.2rem;
        background-color: transparent;
      }

      .drawer-title {
        margin-bottom: 0.26rem;
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        color: #262626;
      }

      .input-box {
        display: flex;
        align-items: center;
        height: 0.4rem;
        padding-right: 0.08rem;
        padding-left: 0.1rem;
        box-shadow: inset 0rem 0.01rem 0.03rem 0rem rgba(255, 255, 255, 0.2);
        border-radius: 0.1rem;
      }

      .input-box input {
        flex: 1;
        border: none;
        height: 100%;
        padding: 0;
        outline: 0;
        background-color: transparent;
        font-size: 0.16rem;
        /* color: #333; */
      }

      .input-box input::placeholder {
        color: #999999;
      }

      .input-suffix {
        color: #999999;
        font-size: 0.14rem;
      }

      .drawer-code-row {
        display: flex;
        justify-content: space-between;
      }

      .drawer-code-btn {
        width: 0.94rem;
        height: 0.4rem;
        box-shadow: inset 0rem 0.01rem 0.03rem 0rem rgba(255, 255, 255, 0.2);
        border-radius: 0.1rem;
        font-size: 0.14rem;
        color: #0056ff;
      }

      .drawer-code-btn:disabled {
        color: #999999;
      }

      .drawer-footer-btn {
        width: 100%;
        height: 0.42rem;
        background: linear-gradient(180deg, #fe8155 0%, #ff261f 100%);
        box-shadow: 0rem 0.02rem 0.04rem 0rem rgba(0, 0, 0, 0.1),
          inset 0rem 0.01rem 0.03rem 0rem rgba(255, 255, 255, 0.2);
        border-radius: 0.1rem;
        font-size: 0.15rem;
        font-family: PingFangSC, PingFang SC;
        font-weight: 500;
        color: #ffffff;
      }

      .image-box {
        background-size: cover;
      }

      .head-image-box {
        position: absolute;
        top: 0;
        left: 0;
        z-index: -1;
      }

      .img-transcript {
        position: absolute;
        width: 3.15rem;
        height: 1.98rem;
        bottom: 0.1rem;
        left: 50%;
        transform: translateX(-50%);
      }

      .form-image-box {
        padding: 0.76rem 0.26rem 0;
      }

      .enterprise {
        margin-top: 0.02rem;
        font-size: 0.12rem;
        line-height: 0.17rem;
        color: #ffffff;
        text-align: center;
      }

      .effect-image-box {
        padding-top: 0.78rem;
      }

      .effect-item {
        display: flex;
        align-items: center;
        margin: 0 0.26rem 0.12rem;
        height: 0.4rem;
        border-radius: 0.1rem;
        background: linear-gradient(164deg, #fff2d6 0%, #fff0d8 100%);
        font-size: 0.14rem;
        font-family: PingFangSC, PingFang SC;
      }

      .effect-item-time {
        flex-shrink: 0;
        width: 1.05rem;
        height: 0.4rem;
        margin-right: 0.08rem;
      }

      .effect-item > span {
        flex-shrink: 0;
      }

      .color-info {
        color: #855433;
      }

      .color-em {
        color: #ff2500;
      }

      /* .top-message {
        overflow: hidden;
        position: fixed;
        z-index: 999;
        top: 0.2rem;
        left: 50%;
        transform: translateX(-50%);
        width: 2rem;
        padding: 0.1rem;
        border-radius: 0.04rem;
        color: #fff;
        border: 1px solid;
        font-size: 0.14rem;
        line-height: 0.18rem;
      }
      .top-message-success {
        background-color: #f0f9eb;
        border-color: #e1f3d8;
        color: #67c23a;
      }
      .top-message-warning {
        background-color: #fdf6ec;
        border-color: #faecd8;
        color: #e6a23c;
      }
      .top-message-error {
        background-color: #fef0f0;
        border-color: #fde2e2;
        color: #f56c6c;
      } */

      .industry-image-box {
        display: flex;
        flex-wrap: wrap;
        align-content: flex-start;
        padding-top: 0.78rem;
        padding-left: 0.26rem;
      }
      .industry-item {
        display: flex;
        align-items: center;
        margin-right: 0.16rem;
        margin-bottom: 0.12rem;
        padding: 0 0.12rem;
        height: 0.32rem;
        background: linear-gradient(180deg, #ffecd1 0%, #ffdebd 100%);
        border-radius: 0.18rem;
        /* line-height: 0.32rem; */
        color: #855433;
        font-size: 0.15rem;
        font-family: PingFangSC, PingFang SC;
      }

      .van-toast {
        padding: 0.16rem 0.24rem;
        background-color: rgba(0, 0, 0, 0.8);
        border-radius: 0.12rem;
        font-size: 0.14rem;
        line-height: 0.2rem;
      }
    </style>
  </head>
  <body style="opacity: 0;">
    <svg
      style="display: none;"
      version="1.1"
      xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink"
    >
      <symbol id="close" viewBox="0 0 20 20">
        <title>icon/20/关闭备份 2</title>
        <g id="最终版" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
          <g id="免费领取全套资料" transform="translate(-343.000000, -574.000000)">
            <g id="icon/20/关闭备份" transform="translate(343.000000, 574.000000)">
              <rect id="矩形" fill="#BFBFBF" opacity="0" x="0" y="0" width="20" height="20"></rect>
              <g id="编组" transform="translate(4.000000, 4.000000)" stroke="#BFBFBF" stroke-width="2.5">
                <line x1="0" y1="0" x2="12" y2="12" id="路径-6"></line>
                <line
                  x1="0"
                  y1="0"
                  x2="12"
                  y2="12"
                  id="路径-6"
                  transform="translate(6.000000, 6.000000) scale(-1, 1) translate(-6.000000, -6.000000) "
                ></line>
              </g>
              <rect id="矩形" x="0" y="0" width="20" height="20"></rect>
            </g>
          </g>
        </g>
      </symbol>
    </svg>

    <main class="page-main por">
      <div
        class="image-box head-image-box"
        style="height: 2.6rem; width: 100%; background-image: url(//image.zlketang.com/public/news/dy_promotion/head_img.png?x-image-process=cq100w100);"
      ></div>
      <div
        class="image-box"
        style="height: 3.34rem; margin-top: 2.2rem; background-image: url(//image.zlketang.com/public/news/dy_promotion/free.png?x-image-process=cq100w100);"
      ></div>
      <div
        class="image-box form-image-box"
        style="height: 2.54rem; background-image: url(//image.zlketang.com/public/news/dy_promotion/form.png?x-image-process=cq100w100);"
      >
        <div id="tel-input-box-1" class="input-box mb12 bgc-f">
          <input type="text" placeholder="请输入手机号（必填）" maxlength="11" />
          <span class="input-suffix">0/11</span>
        </div>
        <div class="mb16 drawer-code-row">
          <div class="input-box bgc-f" style="width: 2.24rem;">
            <input id="code-input-1" type="text" placeholder="请输入验证码" maxlength="11" />
          </div>
          <button id="code-btn-1" class="drawer-code-btn bgc-f">获取验证码</button>
        </div>
        <button id="collect-btn-1" class="drawer-footer-btn">立即领取</button>
      </div>
      <div
        class="image-box"
        style="height: 2.22rem; background-image: url(//image.zlketang.com/public/news/dy_promotion/method.png?x-image-process=cq100w100);"
      ></div>
      <div
        class="image-box"
        style="height: 3.68rem; background-image: url(//image.zlketang.com/public/news/dy_promotion/students.png?x-image-process=cq100w100);"
      ></div>
      <div
        class="image-box por effect-image-box"
        style="height: 4.98rem; background-image: url(//image.zlketang.com/public/news/dy_promotion/effect.png?x-image-process=cq100w100);"
      >
        <div class="effect-item">
          <img class="effect-item-time" src="//image.zlketang.com/public/news/dy_promotion/study_0_5.png?x-image-process=cq100w100" />
          <span class="color-info">您将不再是</span>
          <span class="color-em">初级会计小白</span>
        </div>
        <div class="effect-item">
          <img class="effect-item-time" src="//image.zlketang.com/public/news/dy_promotion/study_2.png?x-image-process=cq100w100" />
          <span class="color-info">您将摸清初级会计的</span>
          <span class="color-em">考试套路</span>
        </div>
        <div class="effect-item">
          <img class="effect-item-time" src="//image.zlketang.com/public/news/dy_promotion/study_5.png?x-image-process=cq100w100" />
          <span class="color-info">您会觉得初级会计考试</span>
          <span class="color-em">并不算难</span>
        </div>
        <div class="effect-item">
          <img class="effect-item-time" src="//image.zlketang.com/public/news/dy_promotion/study_10.png?x-image-process=cq100w100" />
          <span class="color-info">您将初级会计考试</span>
          <span class="color-em">信心满满</span>
        </div>
        <img class="img-transcript" src="//image.zlketang.com/public/news/dy_promotion/transcript.png?x-image-process=cq100w100" />
      </div>
      <div
        class="image-box industry-image-box"
        style="height: 4.9rem; background-image: url(//image.zlketang.com/public/news/dy_promotion/industry.png?x-image-process=cq100w100);"
      >
        <div class="industry-item">批发和零售业</div>
        <div class="industry-item">工业制造行业</div>
        <div class="industry-item">住宿与餐饮行业酒店行业</div>
        <div class="industry-item">房地产行业</div>
        <div class="industry-item">代理记账</div>
        <div class="industry-item">劳务派遣</div>
        <div class="industry-item">进出口贸易</div>
        <div class="industry-item">健身房</div>
        <div class="industry-item">影视传媒</div>
        <div class="industry-item">事务所</div>
        <div class="industry-item">建筑行业</div>
        <div class="industry-item">物流运输</div>
        <div class="industry-item">咨询服务</div>
        <div class="industry-item">旅行社租赁行业</div>
        <div class="industry-item">高新技术</div>
        <div class="industry-item">服务业</div>
        <div class="industry-item">电商行业</div>
        <div class="industry-item">4S汽车业</div>
        <div class="industry-item">物业管理</div>
        <div class="industry-item">农业养殖</div>
        <div class="industry-item">金融行业</div>
        <div class="industry-item">非盈利组织</div>
        <div class="industry-item">培训行业行政事业单位</div>
      </div>
      <div class="enterprise">成都环宇知了科技有限公司</div>
    </main>

    <footer class="page-footer" style="background-color: #fff;">
      <button class="footer-btn">免费领取全套资料</button>
    </footer>

    <div id="drawer-mask" class="mask" style="display: none;">
      <div class="drawer">
        <button class="drawer-close-btn">
          <svg class="svg-icon">
            <use xlink:href="#close"></use>
          </svg>
        </button>
        <div class="drawer-title">免费领取全套资料</div>
        <div id="tel-input-box-2" class="input-box mb12 bgc-f5">
          <input type="text" placeholder="请输入手机号（必填）" maxlength="11" />
          <span class="input-suffix">0/11</span>
        </div>
        <div class="mb24 drawer-code-row">
          <div class="input-box bgc-f5" style="width: 2.41rem;">
            <input id="code-input-2" type="text" placeholder="请输入验证码" maxlength="11" />
          </div>
          <button id="code-btn-2" class="drawer-code-btn bgc-f5">获取验证码</button>
        </div>
        <button id="collect-btn-2" class="drawer-footer-btn">免费领取</button>
      </div>
    </div>

    <script src="//image.zlketang.com/public/news/js/jquery-3.3.1.min.js"></script>
    <script src="//image.zlketang.com/public/news/js/vue_2_5_22.min.js"></script>
    <script src="//image.zlketang.com/public/news/js/vant.min.js"></script>

    <script type="text/javascript">
      !(function() {
        const isProd = location.origin.includes('//zlketang.net')
        // 网络请求的 baseUrl，注意 没有 末尾的斜杠
        const XHR_BASE_URL = ''

        const generateXhrUrl = url => XHR_BASE_URL + url

        // /**
        //  * 全局 message 方法
        //  */
        // const showMessage = (content = '错误', { type } = {}) => {
        //   const typeList = ['warning', 'error', 'success']
        //   type = typeList.includes(type) ? type : typeList[0]

        //   const messageEl = document.createElement('div')
        //   messageEl.classList.add('top-message', `top-message-${type}`)
        //   messageEl.innerText = content

        //   document.body.appendChild(messageEl)
        //   setTimeout(() => {
        //     document.body.removeChild(messageEl)
        //   }, 5000)
        // }

        /**
         * 全局封装 fetch 方法
         */
        const fetchData = (...args) => {
          return fetch(...args).then(async res => {
            // console.log(res)
            if (res.status === 200) {
              const json = await res.json()

              if (+json.errcode === 0) return json.data

              // console.log(res, json)
              vant.Toast(json.errmsg)
            }
            // status !== 200 || errcode !== 0 则进行 reject
            return Promise.reject()
          })
        }

        /******************************
         * * 模块：rem响应式
         ******************************/
        const initRemReactive = () => {
          // rem响应式
          const setRem = () => {
            // 设计图底稿宽度 375px，此时 1rem = 100px
            const BASE_WIDTH = 375,
              BASE_SIZE = 100
            const root = document.documentElement
            root.style.fontSize = (root.clientWidth / BASE_WIDTH) * BASE_SIZE + 'px'
          }

          setRem()
          // 初始化rem后，使网页内容可见
          document.body.style.opacity = '1'

          window.addEventListener('resize', setRem)
        }

        /******************************
         * * 模块：form
         ******************************/
        const initForm = () => {
          // 校验电话号码格式，是否通过
          const validateTel = tel => {
            return /^1\d{10}$/.test(tel)
          }

          // 校验验证码格式，是否通过
          const validateCode = code => {
            return true
          }

          // fetch: 获取验证码
          const getVerificationCode = tel => {
            const originParamJson = JSON.stringify({ tel })
            const sign = btoa(btoa(originParamJson))

            fetchData(generateXhrUrl('/wxpub/activity/sms_send'), {
              method: 'POST',
              body: JSON.stringify({ sign }),
              headers: {
                'Content-Type': 'application/json'
              }
            })
          }

          // fetch: 提交表单，免费领取
          const submitForm = ({ tel, sms_code }) => {
            const dy_url = location.href
            const originParamJson = JSON.stringify({
              tel,
              sms_code,
              dy_url,
              user_name: '抖音SEM自研',
              resource: 'dy_sem',
              resource_code: '10008'
            })
            const sign = btoa(btoa(encodeURIComponent(originParamJson)))

            fetchData(generateXhrUrl('/wxpub/activity/bd_sem_v2'), {
              method: 'POST',
              body: JSON.stringify({ sign }),
              headers: {
                'Content-Type': 'application/json'
              }
            })
              .then(() =>
                fetchData(
                  generateXhrUrl(`/wxpub/thirdAppCallback/phone_dispatch?tel=${tel}&third_source=dy_sem&type=qy_link`),
                  {
                    method: 'GET'
                  }
                )
              )
              .then(res => {
                if (!(res && res.link_url)) return vant.Toast('Error: 无效的链接')

                location.href = res.link_url
              })
          }

          // 获取 dom 并缓存（此页面中这些 dom 不会被移除或替换）
          const form1 = {
            telInputBox: document.getElementById('tel-input-box-1'),
            codeInput: document.getElementById('code-input-1'),
            codeBtn: document.getElementById('code-btn-1'),
            collectBtn: document.getElementById('collect-btn-1')
          }

          const form2 = {
            telInputBox: document.getElementById('tel-input-box-2'),
            codeInput: document.getElementById('code-input-2'),
            codeBtn: document.getElementById('code-btn-2'),
            collectBtn: document.getElementById('collect-btn-2')
          }

          // 两个表单功能一致，这里批量注册事件
          ;[form1, form2].forEach(({ telInputBox, codeInput, codeBtn, collectBtn }) => {
            const telInput = telInputBox.querySelector('input')
            const telInputSuffix = telInputBox.querySelector('.input-suffix')

            // 手机号码 input 事件
            telInput.addEventListener('input', function(e) {
              const count = e.target.value.length
              telInputSuffix.innerText = `${count}/11`
            })

            // 【获取验证码】定时器
            let timer = null

            // 绑定【获取验证码】点击事件
            codeBtn.addEventListener('click', function() {
              const tel = telInput.value
              // 电话号码校验
              if (!validateTel(tel)) {
                return vant.Toast('请输入有效的手机号码')
              }

              getVerificationCode(tel)

              // 清空之前的定时器
              if (timer) {
                clearTimeout(timer)
              }
              let countdown = 59
              codeBtn.innerText = countdown + 's'
              codeBtn.disabled = true

              // 倒计时，1分钟内不可重复获取
              const setTimer = () => {
                timer = setTimeout(() => {
                  if (countdown > 1) {
                    countdown--
                    codeBtn.innerText = countdown + 's'
                    setTimer()
                    return
                  }
                  // 倒计时结束
                  codeBtn.innerText = '重新获取'
                  codeBtn.disabled = false
                }, 1000)
              }
              setTimer()
            })

            // 绑定【免费领取】点击事件
            collectBtn.addEventListener('click', function() {
              const tel = telInput.value
              const code = codeInput.value
              // 表单校验
              if (!validateTel(tel) || !validateCode(code)) {
                return
              }

              submitForm({ tel, sms_code: code })
            })
          })
        }

        /******************************
         * * 模块：footer（弹出层、视口行为）
         ******************************/
        const initFooter = () => {
          const mask = document.getElementById('drawer-mask')
          const footer = document.querySelector('.page-footer')

          // footer btn 点击事件
          footer.querySelector('.footer-btn').addEventListener('click', function() {
            mask.style.display = 'block'
          })

          // 关闭弹出层
          const closeDrawer = () => {
            mask.style.display = 'none'
          }

          document.querySelector('.drawer-close-btn').addEventListener('click', closeDrawer)

          // drawer 阻止 click 冒泡
          // document.querySelector('.drawer').addEventListener('click', function(e) {
          //   e.stopPropagation()
          // })

          // 触发的阈值：最后一个盒子进入视口的比例
          const THRESHOLD_RATIO = 0.9
          // 触底时改变 footer 样式
          const io = new IntersectionObserver(
            entries => {
              entries.forEach(entry => {
                footer.style.backgroundColor = entry.intersectionRatio > THRESHOLD_RATIO ? '' : '#fff'
              })
            },
            { threshold: THRESHOLD_RATIO }
          )

          // 观察最后一个盒子是否几乎完全出现在视口中
          const enterpriseBox = document.querySelector('.enterprise')
          io.observe(enterpriseBox)
        }

        // 初始化各模块
        initRemReactive()
        initForm()
        initFooter()
      })()
    </script>
  </body>
</html>
